Show version of package to be installed (before potential overwrite errors)
authorGeorg Brandl <georg@python.org>
Tue, 24 Jan 2017 06:49:50 +0000 (07:49 +0100)
committerGeorg Brandl <georg@python.org>
Wed, 25 Jan 2017 19:12:16 +0000 (20:12 +0100)
Fixes #3587

src/cargo/ops/cargo_install.rs
tests/install.rs

index 5f97888f95c4bdcd60dee0dfaf2056ea76a441ab..9e1548de353e20db43e0b1641d8d4e6146e4591e 100644 (file)
@@ -97,6 +97,8 @@ pub fn install(root: Option<&str>,
     };
     let pkg = ws.current()?;
 
+    config.shell().status("Installing", pkg)?;
+
     // Preflight checks to check up front whether we'll overwrite something.
     // We have to check this again afterwards, but may as well avoid building
     // anything if we're gonna throw it away anyway.
index eb77c0a2e416a837a76a0edc23b908a031380fe6..cc457eb33ea3f73c910a16d2d927eda4785d5af7 100644 (file)
@@ -37,6 +37,7 @@ fn simple() {
                 execs().with_status(0).with_stderr(&format!("\
 [UPDATING] registry `[..]`
 [DOWNLOADING] foo v0.0.1 (registry [..])
+[INSTALLING] foo v0.0.1
 [COMPILING] foo v0.0.1
 [FINISHED] release [optimized] target(s) in [..]
 [INSTALLING] {home}[..]bin[..]foo[..]
@@ -62,6 +63,7 @@ fn pick_max_version() {
                 execs().with_status(0).with_stderr(&format!("\
 [UPDATING] registry `[..]`
 [DOWNLOADING] foo v0.0.2 (registry [..])
+[INSTALLING] foo v0.0.2
 [COMPILING] foo v0.0.2
 [FINISHED] release [optimized] target(s) in [..]
 [INSTALLING] {home}[..]bin[..]foo[..]
@@ -171,6 +173,7 @@ fn install_path() {
     assert_that(cargo_home(), has_installed_exe("foo"));
     assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()),
                 execs().with_status(101).with_stderr("\
+[INSTALLING] foo v0.1.0 [..]
 [ERROR] binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]`
 Add --force to overwrite
 "));
@@ -336,6 +339,7 @@ fn no_binaries() {
 
     assert_that(cargo_process("install").arg("--path").arg(p.root()).arg("foo"),
                 execs().with_status(101).with_stderr("\
+[INSTALLING] foo [..]
 [ERROR] specified package has no binaries
 "));
 }
@@ -376,6 +380,7 @@ fn install_twice() {
                 execs().with_status(0));
     assert_that(cargo_process("install").arg("--path").arg(p.root()),
                 execs().with_status(101).with_stderr("\
+[INSTALLING] foo v0.1.0 [..]
 [ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])`
 binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])`
 Add --force to overwrite
@@ -409,6 +414,7 @@ fn install_force() {
 
     assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
                 execs().with_status(0).with_stderr(&format!("\
+[INSTALLING] foo v0.2.0 ([..])
 [COMPILING] foo v0.2.0 ([..])
 [FINISHED] release [optimized] target(s) in [..]
 [REPLACING] {home}[..]bin[..]foo[..]
@@ -452,6 +458,7 @@ fn install_force_partial_overlap() {
 
     assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
                 execs().with_status(0).with_stderr(&format!("\
+[INSTALLING] foo v0.2.0 ([..])
 [COMPILING] foo v0.2.0 ([..])
 [FINISHED] release [optimized] target(s) in [..]
 [INSTALLING] {home}[..]bin[..]foo-bin3[..]
@@ -503,6 +510,7 @@ fn install_force_bin() {
                     .arg("--path")
                     .arg(p.root()),
                 execs().with_status(0).with_stderr(&format!("\
+[INSTALLING] foo v0.2.0 ([..])
 [COMPILING] foo v0.2.0 ([..])
 [FINISHED] release [optimized] target(s) in [..]
 [REPLACING] {home}[..]bin[..]foo-bin2[..]
@@ -559,6 +567,7 @@ fn git_repo() {
     assert_that(cargo_process("install").arg("--locked").arg("--git").arg(p.url().to_string()),
                 execs().with_status(0).with_stderr(&format!("\
 [UPDATING] git repository `[..]`
+[INSTALLING] foo v0.1.0 ([..])
 [COMPILING] foo v0.1.0 ([..])
 [FINISHED] release [optimized] target(s) in [..]
 [INSTALLING] {home}[..]bin[..]foo[..]
@@ -697,7 +706,8 @@ fn do_not_rebuilds_on_local_install() {
     assert_that(p.cargo_process("build").arg("--release"),
                 execs().with_status(0));
     assert_that(cargo_process("install").arg("--path").arg(p.root()),
-                execs().with_status(0).with_stderr("[FINISHED] release [optimized] target(s) in [..]
+                execs().with_status(0).with_stderr("[INSTALLING] [..]
+[FINISHED] release [optimized] target(s) in [..]
 [INSTALLING] [..]
 warning: be sure to add `[..]` to your PATH to be able to run the installed binaries
 "));